package com.tang.sharding.schedule.task.jdbc;

import com.tang.sharding.ShardProperties;
import com.tang.sharding.enums.Epoch;
import com.tang.sharding.enums.ShardingCycle;

/**
 * @author Tang
 * @classname InitializingTableRunnableTask
 * @description [ 启动检测 ]
 * @date 2021/8/3 10:52
 */
public class InitializingTableRunnableTask extends AbstractJdbcRunnableTask {

    public InitializingTableRunnableTask(String taskId, JdbcManager jdbcManager,
                                         ShardProperties.TableRule tableRule) {
        super(taskId, jdbcManager, tableRule);
    }

    @Override
    protected String getTableName(String logicTable) {
        ShardingCycle shardingCycle = tableRule.getShardingCycle();
        return this.jdbcManager.getNewTableName(logicTable, shardingCycle, Epoch.present);
    }
}